from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QComboBox, QPushButton

class SettingsDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.init_ui()

    def init_ui(self):
        layout = QVBoxLayout()

        # 波特率设置
        baudrate_label = QLabel("Baudrate:")
        self.baudrate_combo = QComboBox()
        baudrates = [9600, 115200]
        self.baudrate_combo.addItems([str(br) for br in baudrates])
        layout.addWidget(baudrate_label)
        layout.addWidget(self.baudrate_combo)

        # 确定按钮
        ok_button = QPushButton("OK")
        ok_button.clicked.connect(self.accept)
        layout.addWidget(ok_button)

        self.setLayout(layout)
        self.setWindowTitle("Settings")